package cn.chen.数据结构.二叉树.赫夫曼编码;

/**
 *
 * 节点类
 */
public class Node implements Comparable<Node> {

    Byte value; // 存放数据 'a' ==> 97
    int weight; // 记录权值，就是字符出现的次数

    Node left;
    Node right;

    public Node(Byte value, int weight) {
        this.value = value;
        this.weight = weight;
    }

    @Override
    public String toString() {
        return "Node{" +
                "value=" + value +
                ", weight=" + weight +
                '}';
    }

    @Override
    public int compareTo(Node o) {
        return this.weight-o.weight;
    }
}
